
import 'package:flutter/material.dart';

class OopLearn extends StatefulWidget {
  @override
  _OopLearnState createState() => _OopLearnState();
}

class _OopLearnState extends State<OopLearn> {
  @override
  Widget build(BuildContext context) {
    return Container(

    );
  }
}

class Person {
  String name;
  int ages;

  ///标准构造方法
  Person(this.name, this.ages);

  ///重写父类方法
  @override
  String toString() {
    // TODO: implement toString
    return 'name:$name ages:$ages';
  }
}

class Student extends Person{
  String _school;
  String city;//可选参数
  String country; //默认参数
  String name;
  Student(this._school,String name, int ages,{this.city,this.country = 'china'}) : super(name, ages);
  //命名构造方法
  Student.init(this._school,String name, int ages):super(name,ages);
}

class Logger{
  static Logger _cache;
  factory Logger(){
    if (_cache == null) {
      _cache = Logger._internal();
    }
    return _cache;
  }

  Logger._internal();
}